local sk__mingzheng = fk.CreateSkill {

  name = "sk__mingzheng",

  tags = { Skill.Compulsory, },

}



sk__mingzheng:addEffect(fk.DrawNCards, {
  name = "sk__mingzheng",
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(sk__mingzheng.name) then
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    if target == player then
      data.n = data.n + 2
    else
      data.n = data.n + 1
    end
  end,
})
sk__mingzheng:addEffect(fk.PropertyChange, {
  name = "sk__mingzheng",
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(sk__mingzheng.name) then
      return data.general
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local n = #room.logic:getEventsOfScope(GameEvent.Turn, 1, function(e)
      return e.data.who == player
    end, Player.HistoryGame)
    if n > 0 then
      player:drawCards(n, sk__mingzheng.name)
    end
    if not player.dead then
      room:handleAddLoseSkills(player, "-sk__mingzheng|sk__shisha", nil, true, false)
    end
  end,
})
sk__mingzheng:addEffect(fk.Damaged, {
  name = "sk__mingzheng",
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(sk__mingzheng.name) then
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local n = #room.logic:getEventsOfScope(GameEvent.Turn, 1, function(e)
      return e.data.who == player
    end, Player.HistoryGame)
    if n > 0 then
      player:drawCards(n, sk__mingzheng.name)
    end
    if not player.dead then
      room:handleAddLoseSkills(player, "-sk__mingzheng|sk__shisha", nil, true, false)
    end
  end,
})

return sk__mingzheng
